package com.cyzy.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.cyzy.mapper.CourseCategoryMapper;
import com.cyzy.mapper.CourseMapper;
import com.cyzy.pojo.Course;
import com.cyzy.pojo.CourseCategory;
import com.cyzy.service.CourseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author zxw
 * @create 2025-06-04 上午10:27
 */
@Service
public class CourseServiceImpl implements CourseService {
    @Autowired
    private CourseMapper courseMapper;
    @Autowired
    private CourseCategoryMapper courseCategoryMapper;
    @Override
    public List<Course> selectCourse(String campusId, String categoryId) {
        List<Course> list = courseMapper.selectCourse(campusId,categoryId);
        return list;
    }

    @Override
    public List<CourseCategory> selectCourseCategory(String campusId) {
        QueryWrapper<CourseCategory> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("campus_id", campusId).orderByAsc("category_sort");
        return courseCategoryMapper.selectList(queryWrapper);
    }
}
